/* eslint-disable */
/**
 * 打包webworker成一个js文件，wasm和浇水js都转base64字符串
 */

const path = require('path');


const esConfig = {
  target: ["web", "es6"],
  mode: 'development',
  entry: "./ZegoLyricView.ts",
  output: {
    filename: 'ZegoLyricView.esm.js',
    path: path.resolve(__dirname, 'dist'),
  },
  devtool: false,
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: [
          {
            loader: "ts-loader",
            options: {
              compilerOptions: {
                stripInternal: true,
                target: "esnext",
                module: "esnext"
              },
              transpileOnly: true
            }
          },
        ],
        exclude: /node_modules/
      }
    ]
  },
  plugins: [
  ],
}

const browserConfig = {
  target: ["web", "es5"],
  mode: 'production',
  entry: "./ZegoLyricView.ts",
  output: {
    filename: 'ZegoLyricView.browser.js',
    path: path.resolve(__dirname, 'dist'),
    libraryTarget: "umd",
    umdNamedDefine: true,
    globalObject: "typeof self !== 'undefined' ? self : this"
  },
  devtool: false,
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: [
          {
            loader: "ts-loader",
            options: {
              compilerOptions: {
                stripInternal: true,
                target: "es5",
                module: "commonjs"
              },
              transpileOnly: true
            }
          },
        ],
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: ['.tsx', '.ts', '.js'], // 解析这些扩展名的文件
  },
  plugins: [
  ],
}

module.exports = [
  esConfig,
  browserConfig
];